<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>华鑫农业信息管理系统</title>
<link rel="stylesheet" type="text/css" href="../style/css.css">
<script language="javascript" type="text/javascript" src="../js/jquery1.4.min.js"></script>
<script language="javascript" type="text/javascript" src="../js/jquery.jslider.js"></script>
    <script type="text/javascript" src="../js/myScript/app.js"></script>
</head>
<body>
<div class="wrap">

  <jsp:include page="top.jsp"/>

  <div class="main">
    <div class="mainr right">
      <h2><span class="ny_nav">您当前所在的位置：<a href="">首页</a> &gt; 新闻动态</span>新闻动态</h2>
      <div class="news_list">
        <ul id="list">
            <li><span class="rq">【02-29】</span><a href="subnews.jsp">卡纸对裱机;手动、自动模切....</a></li>
            <li><span class="rq">【02-29】</span><a href="#">来越受到环保与卫环保与卫生方面的</a></li>
            <li><span class="rq">【02-29】</span><a href="#">越受到环与卫生方面的制</a></li>
            <li><span class="rq">【02-29】</span><a href="#">方越受环保与卫生方面的制</a></li>
            <li><span class="rq">【02-29】</span><a href="#">卡纸对裱机;手动、自动模切....</a></li>
            <li><span class="rq">【02-29】</span><a href="#">来越受到环保与卫环保与卫生方面的</a></li>
            <li><span class="rq">【02-29】</span><a href="#">越受到环与卫生方面的制</a></li>
            <li><span class="rq">【02-29】</span><a href="#">方越受环保与卫生方面的制</a></li>
            <li><span class="rq">【02-29】</span><a href="#">卡纸对裱机;手动、自动模切....</a></li>
            <li><span class="rq">【02-29】</span><a href="#">来越受到环保与卫环保与卫生方面的</a></li>
            <li><span class="rq">【02-29】</span><a href="#">越受到环与卫生方面的制</a></li>
            <li><span class="rq">【02-29】</span><a href="#">方越受环保与卫生方面的制</a></li>
          </ul>
        <div class="clear"></div>
      </div>
    </div>
    <div class="clear"></div>
  </div>
  <jsp:include page="buttom.jsp"/>
</div>

<script type="text/javascript">
    $.ajax({
        type: "GET",
        url: serverUrl + "/news/queryNews",
        xhrFields: {
            withCredentials:true
        },
        dataType: "json",
        success: function (res) {
            if (res.success) {
                $("#list").empty();
                var data = res.data;
                for (var i = 0; i < data.length; i++) {
                    var time = data[i].nkTime;
                    var src = time.split(" ")[0];
                    $("#list").append("<li onclick='skipNews(this)' id='"+data[i].nkId +"'><span class=\"rq\">【"+ src +"】</span><a>"+ data[i].nkTitle +"</a></li>")
                }
            }
        }
    });

    function skipNews(element) {
        var id = element.getAttribute("id");
        window.location.href="subnews.jsp?id=" + id;
    }
</script>
</body>
</html>
